import time

def bubble_sort(nums):
    swapped = True
    while swapped:
        swapped = False
        for i in range(len(nums) - 1):
            if nums[i] > nums[i + 1]:
                nums[i], nums[i + 1] = nums[i + 1], nums[i]
                swapped = True


def readl(*args):
    f = open(args[0])
    data = f.readlines()
    return data


t1 = readl('m1_sorted.txt')
time_start = time.time()
bubble_sort(t1)
time_finish = time.time()
print(f'm1_sorted {time_start - time_finish} miliseconds')
t2 = readl('m2_reverse.txt')
time_start = time.time()
bubble_sort(t2)
time_finish = time.time()
print(f'm2_reverse {time_start - time_finish} miliseconds')
t3 = readl('m3_shuffle.txt')
time_start = time.time()
bubble_sort(t3)
time_finish = time.time()
print(f'm3_shuffle {time_start - time_finish} miliseconds')